<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>章节列表</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="__PUBLIC__/admin/css/bootstrap.min.css">
    <!--<link href="__PUBLIC__/admin/css/jquery.webui-popover.min.css" rel="stylesheet">-->
    <!--<link href="__PUBLIC__/admin/css/font-awesome.min.css" rel="stylesheet">-->
    <link href="__PUBLIC__/admin/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/toastr.min.css" rel="stylesheet">
    <!--<link href="__PUBLIC__/admin/css/jquery.fileupload.min.css" rel="stylesheet">-->
    <!--<link href="__PUBLIC__/admin/css/select2.min.css" rel="stylesheet">-->
    <link href="__PUBLIC__/admin/css/cc.css" rel="stylesheet">
    <!-- page specific plugin styles -->
    <script src="__PUBLIC__/admin/js/jquery.min.js"></script>
    <script src="__PUBLIC__/admin/js/lodash.min.js"></script>
    <script src="__PUBLIC__/admin/js/moment.min.js"></script>
    <script src="__PUBLIC__/admin/js/zh-cn.js"></script>
    <script src="__PUBLIC__/admin/js/numeral.min.js"></script>
    <script src="__PUBLIC__/admin/js/toastr.min.js"></script>
    <script src="__PUBLIC__/admin/js/cookies.js"></script>
    <script src="__PUBLIC__/admin/js/knockout-min.js"></script>
    <script src="__PUBLIC__/admin/js/knockout.mapping.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap-datetimepicker.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.validate.min.js"></script>
    <script src="__PUBLIC__/admin/js/jquery.validate.unobtrusive.min.js"></script>
    <script src="__PUBLIC__/admin/js/clipboard.min.js"></script>
    <script src="__PUBLIC__/admin/js/select2.min.js"></script>
    <script src="__PUBLIC__/admin/js/admin.js"></script>
    <script src="__PUBLIC__/admin/js/K.js"></script>

    <script>
      moment.locale('zh-cn');
      toastr.options.positionClass = 'toast-bottom-right';
    </script>

    <!-- text fonts -->
    <link rel="stylesheet" href="__PUBLIC__/admin/css/ace-fonts.css">

    <!-- ace styles -->
    <link rel="stylesheet" href="__PUBLIC__/admin/css/ace.min.css" id="main-ace-style">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/ace-skins.min.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/ace-rtl.min.css">
    <!--<link href="__PUBLIC__/admin/css/jquery.jgrowl.min.css" rel="stylesheet">-->
    <link rel="stylesheet" href="__PUBLIC__/admin/css/admin.css">
    <script src="__PUBLIC__/admin/js/ace-extra.min.js"></script>
  </head>

  <body class="no-skin" >
 <include file="./Public/gong/title.html" />

    <div class="main-container" id="main-container">
      <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
      </script>

      <div id="sidebar" class="sidebar responsive">
          <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
          </script>

<include file="./Public/gong/list.html" />
          <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
            <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
          </div>

          <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
          </script>
      </div>

      <!-- /section:basics/sidebar -->
      <div class="main-content">
        <div class="breadcrumbs" id="breadcrumbs">
          <script type="text/javascript">
            try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
          </script>

          <ul class="breadcrumb">
            <li>
              <i class="ace-icon fa fa-home home-icon"></i>
              <a href="__APP__/Admin/Index/index.html">Home</a>
            </li>
            <li class="active">《{$book.title}》</li>
          </ul><!-- /.breadcrumb -->
        </div>
        <div class="page-content">
          <div class="page-content-area">
            <div class="row">
              <div class="col-xs-12">
<div class="container-fluid">
        <div class="row">
        <div class="col-sm-3">
            <img src="{$book.img}" style="max-width:100%;height:280px;width:200px;">
            <h4 style="font-size: 12px;">《{$book.title}》</h4>
             <div style="line-height: 1.7em;margin-top:10px;" class="text-muted">
            </div> 
            <div class="text-muted" style="margin-top:10px;line-height: 1.7em;">
                {$book.content}
            </div>
            <a href="__URL__/edit_book?id={$book.id}" class="btn">编辑书籍</a>&nbsp;&nbsp;
            <a href="{:U('add_book_info',['id'=>$book['id']])}" class="btn">增加章节</a>&nbsp;&nbsp;
            <p></p>
            <if condition="$admin['level'] heq '0'">
                <a href="{:U('delall_bookinfo',['id'=>$book['id']])}" class="btn" onclick="javascript:return delall_bookinfo()">删除本书</a>&nbsp;&nbsp;
            <else />
                
            </if>
        </div>
            <div class="col-sm-9">
                <form action="{:U('book_share',['bid'=>$book['id']])}" method='get'>
                    <input name="titlekeyword" value="{$titlekeyword}" />
                    <input type="submit" class="btn btn-primary" value="搜索">
                </form>
                <a href="__URL__/book_share?bid={$book.id}&sequence=ASC" class="btn">正序</a>
                <a href="__URL__/book_share?bid={$book.id}&sequence=DESC" class="btn">倒序</a>
                <div class="pager">{$page}</div>
                <span><a href="__URL__/book_list" class="btn">返回书籍列表</a></span>
            </div>
        <div class="col-sm-9">
            <form class="forme" action="__URL__/edit_book_chanrge" method="POST">
            <input type="hidden" name="id" value="{$book.id}">
            <ul class="list-group" style="margin-left:0">
                <volist name="bookinfo" id="vi">
                    <li class="list-group-item chapter-item">
                    <input type="checkbox" name="arr_biid[]"  value="{$vi.id}" autocomplete="off" />
                          <span style="display:inline-block;min-width:26px;">{$vi.number}</span>
                          <!--<input name="countword" value="{$vi['content']|count_word}" type="hidden"/>-->
                          <span class="countToal"><b  style="color:red;">{$vi['content']|count_word}</b>字数</span>
                          <a href="{:U('edit_bookinfo',array('id'=>$vi['id']))}" class="chapter-title" data-toggle="view-chapter">
                            {$vi.title2}
                        </a>

                        <span style="font-size:12px;margin-left:5px">
                            <if condition="$vi['gold'] heq '0'">
                            <span style="color:forestgreen">免费</span>
                            <else />
                            <span style="color:red">收费￥{$vi.gold}</span>
                            </if>
                        </span>
                            

                            <span class="pull-right">
                                <if condition="$vi['number'] lt '6'">
                                    <a target="_blank" data-toggle="tooltip" title="" href="__URL__/book_article?id={$vi.id}" data-original-title="文案内容到当前章节，原文链接为下一章">
                                        <i class="fa fa-link"></i> 生成推广文案
                                    </a>
                                    <a target="_blank" data-toggle="tooltip"  href="javascript:;" data-id="{$vi.id}" data-bid="{$vi.bid}" data-number="{$vi.number}"  data-type="img" class="creatlink">
                                        <i class="fa fa-link"></i> 获取图片文案
                                    </a>
                                    <a title=""  data-bid="{$vi.bid}" data-number="{$vi.number}" data-id="{$vi.id}" data-original-title="原文链接为当前章节" class="creatlink">
                                        <i class="fa fa-link"></i> 获取推广链接
                                    </a>
                                </if>
                                    <a title="" href="__URL__/edit_bookinfo?id={$vi.id}"   data-original-title="原文链接为当前章节">
                                        <i class="fa fa-link"></i> 编辑
                                    </a>
                                <if condition="$admin['level'] heq '0'">
                                    <a title="" href="__URL__/del_bookinfo?id={$vi.id}&tid={$book.tid}&bid={$book.id}" onclick="javascript:return delete_confirm()">
                                        <i class="fa fa-link"></i> 删除
                                    </a>
                                <else />

                                </if>
                                   
                                <!--  <span class="text-success"><i class="fa fa-check-circle"></i> 编辑文章</span> -->
                            </span>
                        </li>
                    </volist>
                </ul>
                <div  style="border: 1px solid rgb(221, 221, 221);margin-top: -21px;padding: 10px;">
                    <input type="button" id="btn1" value="全选"> 
                    <input type="button" id="btn2" value="取消全选"> 
                    <input type="text" name="gold" placeholder="点此输入收费金额" autocomplete="off" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" />
                    <input type="submit" id="subform" value="部分收费" style="border-radius: 5px;background:#438eb9;color:#fff;width:70px;height:35px"/>
                    <a class="btn btn-success btn-xs" href="{:U('changeNumber',['bid'=>$book['id']])}">更正章节序号（新添加书籍必须设置）</a>
                </div>
            </form>
            <div>
                <form class="forme" action="{:U('edit_book_chanrge2')}" method="POST">
                    <input type="hidden" name="id" value="{$book.id}">
                    <input type="text" name="gold" placeholder="点此输入收费金额" autocomplete="off" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" />
                    <input type="submit" value="整本" style="border-radius: 5px;background:#438eb9;color:#fff;width:70px;height:35px"/>
                </form>
            </div>
        </div>
    </div>
</div>
<div class="pager">{$page}</div>
<div id="big" style="display:none;">
    <div class="big-div">
        <div class="bb">
            <div class="bb-div">
                <button type="button" class="close" style="margin-top:10px;margin-right:20px;"><span style="font-size:28px;">x</span></button>
                <h4 >推广链接生成成功</h4>
            </div>
            <div class="modal-body">
                <div>
                    请复制下方推广链接，后续您可以在后台菜单的"推广链接"中找到它并查看统计数据:
                </div>
                <div style="margin:10px 0;" id="fe_text">
                    http://
                </div>
                <div style="margin:10px 0;color:red;font-weight:bold;">
                    <i class="fa fa-info-circle"></i>
                     请务必使用此链接作为文案的原文链接，不要使用微信中点开后手工复制的链接
                </div>
            </div>
            <div class="modal-footer" id="clip_container">
                <button type="button" class="btn btn-primary"  id="d_clip_button" >复制链接</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
  
$(".form").submit(function(e){
    var freetime = "{$book['free_time']}";
  if(freetime=='0'){
      alert('本书已设置为免费书籍了，不再再设置价格');
      return false;
  }
});
  
  
  $("#btn1").click(function(){ 
$("input[name='arr_biid[]']").attr("checked","true"); 
})
  
  $("#btn2").click(function(){ 
$("input[name='arr_biid[]']").removeAttr("checked"); 
}) 
  
$('.creatlink').click(function(event) {
    var bid = $(this).data('bid');
    var number = $(this).data('number');
    var id = $(this).data('id');
    var type = $(this).data('type');
    type = type?type:'';
    console.log(type);
    $.get('__URL__/creatlinks',{bid:bid,number:number,id:id,type:type},function(data) {
        if(data == 'false')
        {
            alert('生成失败，请重试');
        }else{
            //alert(data);
            $('#big').css('display','block');
            console.log(data);
            $('#fe_text').html(data);
        }
    });
    //alert(id);
});
$('.close').click(function(event) {
    $('#big').css('display','none');
});
$('.updateCountword').click(function(){
   var countToal =  $('.countToal').size();
   alert(countToal);
});
</script>

<!-- js复制内容 -->

<script type="text/javascript">
$("#d_clip_button").click(function(){
    var $div = $('#fe_text').html();
    var str = $div;
    K.Tool.copy(str.replace(/&amp;/g,"&"))
});

</script>

<!-- 删除章节 -->

<script type="text/javascript">
    function delete_confirm() { 

    var msg = "您真的确定要删除吗？\n\n请确认！"; 
    if (confirm(msg)==true){ 
            return true; 
        }else{ 
            return false; 
        } 
    }
    
    function delall_bookinfo() { 

    var msg = "您真的确定要删除吗？\n\n请确认！"; 
    if (confirm(msg)==true){ 
            return true; 
        }else{ 
            return false; 
        } 
    }
</script>

<div id="view-chapter-modal" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title"></h4>
            </div>
            <div class="modal-body">
                <div class="chapter-content" style="overflow: auto; height: 478px;"></div>
            </div>
            <div class="modal-footer">
                <button type="button" data-toggle="view-chapter" class="btn btn-default btn-prev-chapter">上一章</button>
                <button type="button" data-toggle="view-chapter" class="btn btn-primary btn-next-chapter">下一章</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


                                <!-- PAGE CONTENT ENDS -->
                            </div><!-- /.col -->
                        </div><!-- /.row -->
                    </div><!-- /.page-content-area -->
                </div><!-- /.page-content -->
            </div><!-- /.main-content -->

        </div><!-- /.main-container -->

        <script src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.webui-popover.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.ui.widget.min.js"></script>
        <script src="__PUBLIC__/admin/js/jquery.fileupload.min.js"></script>
        <script src="__PUBLIC__/admin/js/ace-elements.min.js"></script>
        <script src="__PUBLIC__/admin/js/ace.min.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/admin/css/ace.onpage-help.css">
        <script src="__PUBLIC__/admin/js/elements.onpage-help.js"></script>
        <script src="__PUBLIC__/admin/js/ace.onpage-help.js"></script>


</body>
</html>